package cn.edu.zafu.bigdata.x.wupeng.g;

import java.io.*;

public class BufferDemo {
    public static void main(String[] args) {
        File outputFile = new File("files/world.txt");
        //记录代码执行时间
        long start = System.currentTimeMillis();
        try {
            FileOutputStream out = new FileOutputStream(outputFile);
            int c = 0;
            while (c++<10000){
                out.write(c);
                out.flush();
            }
            out.close();
            long end = System.currentTimeMillis();
            System.out.println("执行时间："+(end-start)+"ms");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
